
import requests
import os
'''
num = 1

while True:
	url = 'https://heavenlyfood.cn/hymnal/pu/da/' + str(num) + '.png'
	root = os.getcwd() + '/大本/'
	path = root+ url.split('/')[-1] #取图片文件名

	try:
		if not os.path.exists(root): #文件夹不存在，则创建文件夹
			os.mkdir(root)
		if not os.path.exists(path): #若图片未被爬取，则爬取图片并保存
			r = requests.get(url)
			f=open(path,'wb')
			f.write(r.content)
			f.close()
			print('文件保存成功')
		else:
			print("文件已存在")
		num+=1
	except :
		print('爬取失败')

'''
from wxpy import *
bot = Bot()
self = bot.self
@bot.register(chats=Friend)
def friend_msg(msg):
    """接收好友消息"""
    if msg.type == TEXT:
        path = '大本/'+ '5' + '.png'
        bot.file_helper.send_image(path)
        msg.reply(msg.text)
bot.join()